#!/bin/sh

cd /etc/uci-defaults || exit 0
source /etc/os-release

OMRVERSION=$(echo $VERSION | sed 's/v//')
files="$(ls /etc/uci-defaults/)"
[ -n "$files" ] && {
	mkdir -p /usr/share/omr-update
	if [ "$(grep rom /etc/mtab)" = "" ]; then
		rm /usr/share/omr-update/*
		cp /etc/uci-defaults/* /usr/share/omr-update
	fi
	uci -q set openmptcprouter.settings=settings
	uci -q set openmptcprouter.settings.version=${OMRVERSION}
	uci -q commit
}
exit 0
